#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	static int AM[100][100];
	int n;
	int i, j, v;
	int in, out;

	scanf("%d", &n);

	i = j = 0;
	while (i < n) {
		j = 0;
		while (j < n) {
			scanf("%d", &AM[i][j]);
			j++;
		}
		i++;
	}

	v = 0;
	while (v < n) {
		i = 0;
		j = v;
		in = 0;
		while (i < n) {
			if (AM[i][j]) in++;
			i++;
		}

		i = v;
		j = 0;
		out = 0;
		while (j < n) {
			if (AM[i][j]) out++;
			j++;
		}

		printf("%d %d\n", in, out);
		v++;
	}

	return (0);
}
